<template>
	<view class="modal center" :class="{hidden:!show}" @click="click" data-name="modal">
		<view style="width: 100%;margin-top: -100rpx;">
			<view class="flexR" style="padding-right: 9%;">
				<view class="exit-btn" @click="exit">
					x
				</view>
			</view>
			<view class="center">
				<slot></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			show: {
				type: Boolean,
				default: false
			}
		},
		data() {
			return {

			};
		},
		methods: {
			click(e){
				if(e.target.dataset && e.target.dataset.name == 'modal') this.exit()
			},
			exit() {
				this.$emit('update:show', !this.show)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.modal {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		transition: all 0.3s;
		opacity: 1;
		transform: scale(1);
		/* #ifdef H5 */
		padding: 120rpx 0;
		/* #endif */


		&.hidden {
			opacity: 0;
			visibility: hidden;
			transform: scale(1.6);
		}
		.exit-btn{
			font-size: 38rpx;
			color: #999;
			transform: scaleX(1.5);
			padding: 8rpx 25rpx;
			&:active{
				color: #333;
			}
		}
	}
</style>
